package demo1;

import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 石方旭
 * Date: 2022-08-09
 * Time: 9:41
 */
public class TestDemo3 {

    //InputStream--- read()
    public static void main(String[] args) {
        try(InputStream inputStream = new FileInputStream("text.txt")){
            while(true){
                int b = inputStream.read();
                if(b==-1){
                    break;
                }
                System.out.printf("%c",b);
            }
        }catch(IOException e){
            e.printStackTrace();
        }
    }

}
